package com.asialjim.wechat.official.cloud;

import com.asialjim.wechat.official.message.wiki.MsgWikiService;
import com.asialjim.wechat.official.message.wiki.vo.MsgWiki;
import com.asialjim.wechat.official.message.wiki.vo.MsgWikiFunctionInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * <h1><em>ASIAL JIM JAVA DOC</em></h1><hr/>
 * <h2>CLASS DESCRIPTION <i>[ NAME: MsgWikiCloud ]</i></h2><strong>
 * <p> msg wiki cloud service
 * </strong><p><p><em>Copyright &copy; Asial Jim Co., LTD</em><hr/>
 *
 * @author Asial Jim &nbsp;&nbsp; <span>Email:<a href="mailto:asialjim@hotmail.com">asialjim@hotmail.com</a> &nbsp;&nbsp; <a href="asialjim@qq.com">asialjim@qq.com</a></span>
 * @version 1.0.0
 * @since 2021/3/30   &nbsp;&nbsp; JDK 8
 */
@RestController
@AllArgsConstructor
@Api("微信消息知识库管理服务")
@RequestMapping("/we_chat/official/message/wiki")
public class MsgWikiCloud {
    private final MsgWikiService msgWikiService;

    @GetMapping("/functions")
    @ApiOperation("获取所有知识库功能信息")
    public List<MsgWikiFunctionInfo> wikiFunctionInfos(){
        return msgWikiService.wikiFunctionInfos();
    }

    @PostMapping("/add")
    @ApiOperation("添加一个知识库")
    public Boolean add(@RequestBody MsgWiki wiki){
        return msgWikiService.add(wiki);
    }

    @GetMapping("/page/{size}/{number}")
    @ApiOperation("分页查询所有微信消息知识库")
    public IPage<MsgWiki> page(@PathVariable("size") Integer size, @PathVariable("number") Integer number){
        return msgWikiService.page(size,number);
    }

    @GetMapping("查询5条知识库信息")
    @ApiOperation("查询5条知识库信息")
    public List<MsgWiki> page(){
        return page(5,1).getRecords();
    }


}
